using System;
using PowerSearch.Core;
//using PowerSearch.Utils.Logger;
using PowerSearch.AppServices.Parser.Provider;

namespace PowerSearch.AppServices.Parser
{
	public class FeedParserFactory
	{
		public IFeedParser GetParser(string providerName)
		{
			IFeedParser parser = null;

			if (providerName == null)
				providerName = "";

			if (providerName.Equals(PROVIDER.Youtube.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new YoutubeParser();
			else if (providerName.Equals(PROVIDER.Wikipedia.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new WikipediaParser();
			else if (providerName.Equals(PROVIDER.Flickr.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new FlickrParser();
			else if (providerName.Equals(PROVIDER.Ebay.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new EbayParser();
			else if (providerName.Equals(PROVIDER.Twitter.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new TwitterParser();
			else if (providerName.Equals(PROVIDER.BBC.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new BBCParser();
			else if (providerName.Equals(PROVIDER.ESPN.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new ESPNParser();
			else if (providerName.Equals(PROVIDER.Yahoo.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new YahooParser();
			else if (providerName.Equals(PROVIDER.CNN.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new CNNParser();
			else if (providerName.Equals(PROVIDER.HuffingtonPost.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new HuffingtonPostParser();
			else if (providerName.Equals(PROVIDER.TMZ.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new TMZParser();
			else if (providerName.Equals(PROVIDER.PeopleMagazine.ToString(), StringComparison.OrdinalIgnoreCase))
				parser = new PeopleMagazineParser();
			else
			{
				//Logger.LogError(new ApplicationException("Provider not found"), "Provider: " + providerName);
			}

			return parser;
		}
	}
}

